/* Copyright (c) 2025 Beijing Semidrive Technology Corporation
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/** *****************************************************************************************************
 *  \file     Mcu_PllDrv.h                                                                           *
 *  \brief    This file contains interface header for MCU MCAL driver, ...                             *
 *                                                                                                      *
 * <table>                                                                                              *
 * <tr><th>Date           <th>Version                                                                   *
 * <tr><td>2023/08/02     <td>1.0.0                               *
 * </table>                                                                                             *
 *******************************************************************************************************/

#ifndef MCU_PLLDRV_H
#define MCU_PLLDRV_H

/********************************************************************************************************
 *                                      Include header files                                            *
 *******************************************************************************************************/
#include "Mcu_Pll.h"
#include "Mcu_GeneralTypes.h"
/********************************************************************************************************
 *                                  Global Function Declarations                                        *
 *******************************************************************************************************/
/** *****************************************************************************************************
 * \brief pll enable
 * .
 *
 * \verbatim
 * Syntax             : Std_ReturnType Mcu_Ip_PllDrvEnable(const Mcu_ClkNodeType *clkPtr)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : clkPtr - Pointer to clock node
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : errID
 *
 * Description        : pll enable
 * .
 * \endverbatim
 *******************************************************************************************************/
Std_ReturnType Mcu_Ip_PllDrvEnable(const Mcu_ClkNodeType *clkPtr);

/** *****************************************************************************************************
 * \brief pll disable
 * .
 *
 * \verbatim
 * Syntax             : Std_ReturnType Mcu_Ip_PllDrvDisable(const Mcu_ClkNodeType *clkPtr)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : clkPtr - Pointer to clock node
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : errID
 *
 * Description        : pll disable
 * .
 * \endverbatim
 *******************************************************************************************************/
Std_ReturnType Mcu_Ip_PllDrvDisable(const Mcu_ClkNodeType *clkPtr);

/** *****************************************************************************************************
 * \brief pll frequency prepare
 * .
 *
 * \verbatim
 * Syntax             : Std_ReturnType Mcu_Ip_PllDrvPrepare(const Mcu_ClkNodeType *clkPtr, Mcu_PllRateType vcoRate,
 *                      Mcu_PllRateType ck0Rate, Mcu_PllRateType ck1Rate, const Mcu_PllSpreadConfigType *spreadConfig)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : clkPtr - Pointer to clock node
 *                      vcoRate - vco rate to set
 *                      ck0Rate - pll ck0 output rate to set
 *                      ck1Rate - pll ck1 output rate to set
 *                      spreadConfig - Pointer to spread config
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : errID
 *
 * Description        : pll frequency prepare
 * .
 * \endverbatim
 *******************************************************************************************************/
Std_ReturnType Mcu_Ip_PllDrvPrepare(const Mcu_ClkNodeType *clkPtr, Mcu_PllRateType vcoRate,
                                    Mcu_PllRateType ck0Rate, Mcu_PllRateType ck1Rate, const Mcu_PllSpreadConfigType *spreadConfigPtr);

/** *****************************************************************************************************
 * \brief pll frequency get
 * .
 *
 * \verbatim
 * Syntax             : Mcu_ClkRateType Mcu_Ip_PllDrvGetRate(Mcu_ClkNodeType *clkPtr)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : clkPtr - Pointer to clock node
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : pll frequency
 *
 * Description        : pll frequency get
 * .
 * \endverbatim
 *******************************************************************************************************/
Mcu_ClkRateType Mcu_Ip_PllDrvGetRate(const Mcu_ClkNodeType *clkPtr);


/** *****************************************************************************************************
 * \brief pll check locked.
 *
 * \verbatim
 * Syntax             : uint8 Mcu_Ip_PllDrvIsLocked(const Mcu_ClkNodeType *clkPtr)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : clkPtr - Pointer to clock node
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : pll lock state
 *
 * Description        : get the pll lock state.
 *                      return 1 means in lock, 0 means unlock.
 *
 * \endverbatim
 *******************************************************************************************************/
uint8 Mcu_Ip_PllDrvIsLocked(const Mcu_ClkNodeType *clkPtr);

#endif /* MCU_PLLDRV_H */
/* End of file */
